Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
}
{$IFC UNDEFINED UsingIncludes}
{$SETC UsingIncludes := 0}
{$ENDC}
{$IFC NOT UsingIncludes}
UNIT NumberFormatting;
INTERFACE
{$ENDC}
{$IFC UNDEFINED __NUMBERFORMATTING__}
{$SETC __NUMBERFORMATTING__ := 1}
{$I+}
{$SETC NumberFormattingIncludes := UsingIncludes}
{$SETC UsingIncludes := 1}
{$IFC UNDEFINED __CONDITIONALMACROS__}
{$I ConditionalMacros.p}
{$ENDC}
{$IFC UNDEFINED __TYPES__}
{$I Types.p}
{$ENDC}
{$IFC FOR_SYSTEM8_PREEMPTIVE }
{$IFC UNDEFINED __TEXTOBJECTS__}
{$I TextObjects.p}
{$ENDC}
{$IFC UNDEFINED __TEXTCOMMON__}
{$I TextCommon.p}
{$ENDC}
{$IFC UNDEFINED __LOCALEOBJECTS__}
{$I LocaleObjects.p}
{$ENDC}
{$IFC UNDEFINED __TEXTPARSER__}
{$I TextParser.p}
{$ENDC}
{$ENDC}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
{$IFC UNDEFINED __INTLRESOURCES__}
{$I IntlResources.p}
{$ENDC}
{$ENDC}
{$PUSH}
{$ALIGN MAC68K}
{$LibExport+}
{
Here are the current System 7 routine names and the translations to the older forms.
Please use the newer forms in all new code and migrate the older names out of existing
code as maintainance permits.
New Name Old Name(s)
ExtendedToString FormatX2Str
FormatRecToString Format2Str
NumToString
StringToExtended FormatStr2X
StringToFormatRec Str2Format
StringToNum
}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
TYPE
NumFormatStringPtr = ^NumFormatString;
NumFormatString = PACKED RECORD
fLength: UInt8;
fVersion: UInt8;
data: PACKED ARRAY [0..253] OF CHAR; { private data }
END;
NumFormatStringRec = NumFormatString;
NumFormatStringRecPtr = ^NumFormatStringRec;
{$ENDC}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
TYPE
FormatStatus = INTEGER;
CONST
fVNumber = 0; { first version of NumFormatString }
TYPE
FormatClass = SInt8;
CONST
fPositive = 0;
fNegative = 1;
fZero = 2;
TYPE
FormatResultType = SInt8;
CONST
fFormatOK = 0;
fBestGuess = 1;
fOutOfSynch = 2;
fSpuriousChars = 3;
fMissingDelimiter = 4;
fExtraDecimal = 5;
fMissingLiteral = 6;
fExtraExp = 7;
fFormatOverflow = 8;
fFormStrIsNAN = 9;
fBadPartsTable = 10;
fExtraPercent = 11;
fExtraSeparator = 12;
fEmptyFormatString = 13;
TYPE
FVectorPtr = ^FVector;
FVector = RECORD
start: INTEGER;
length: INTEGER;
END;
{ index by [fPositive..fZero] }
TripleInt = ARRAY [0..2] OF FVector;
{$ENDC}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
PROCEDURE StringToNum(theString: Str255; VAR theNum: LONGINT);
PROCEDURE NumToString(theNum: LONGINT; VAR theString: Str255);
{$ENDC}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
FUNCTION ExtendedToString(VAR x: extended80; {CONST}VAR myCanonical: NumFormatString; {CONST}VAR partsTable: NumberParts; VAR outString: Str255): FormatStatus;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $8210, $FFE8, $A8B5;
{$ENDC}
FUNCTION StringToExtended(source: Str255; {CONST}VAR myCanonical: NumFormatString; {CONST}VAR partsTable: NumberParts; VAR x: extended80): FormatStatus;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $8210, $FFE6, $A8B5;
{$ENDC}
FUNCTION StringToFormatRec(inString: Str255; {CONST}VAR partsTable: NumberParts; VAR outString: NumFormatString): FormatStatus;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $820C, $FFEC, $A8B5;
{$ENDC}
FUNCTION FormatRecToString({CONST}VAR myCanonical: NumFormatString; {CONST}VAR partsTable: NumberParts; VAR outString: Str255; VAR positions: TripleInt): FormatStatus;
FUNCTION GetNumberFormatterObjectFromRef(locale: LocaleRef; VAR numberFormatterObject: LocaleNumberFormatterObjectRef): OSStatus; C;
FUNCTION GetNumberFormatterObjectFromID(localeID: LocaleIdentifier; VAR numberFormatterObject: LocaleNumberFormatterObjectRef): OSStatus; C;
FUNCTION GetCurrentNumberFormatterObject(VAR numberFormatterObject: LocaleNumberFormatterObjectRef): OSStatus; C;
FUNCTION GetNumberFormatterObjectInfo(numberFormatterObject: LocaleNumberFormatterObjectRef; VAR theEncoding: TextEncoding; VAR theLocaleIdentifier: LocaleIdentifier): OSStatus; C;
FUNCTION CreateCustomNumberFormatLocaleObject(numberFormatterObject: LocaleNumberFormatterObjectRef; VAR customNumberFormatterObject: LocaleNumberFormatterObjectRef): OSStatus; C;
FUNCTION DeleteCustomNumberFormatLocaleObject(customNumberFormatterObject: LocaleNumberFormatterObjectRef): OSStatus; C;
FUNCTION SetNumFmtTokenToParserToken(customNumberFormatterObject: LocaleNumberFormatterObjectRef; tokenID: NumberFormatterTokenID; theToken: BasicToken): OSStatus; C;
FUNCTION GetParserTokenFromNumFmtToken(customNumberFormatterObject: LocaleNumberFormatterObjectRef; tokenID: NumberFormatterTokenID; VAR theToken: BasicToken): OSStatus; C;
FUNCTION GetNumberFormatterTextFromToken(customNumberFormatterObject: LocaleNumberFormatterObjectRef; tokenID: NumberFormatterTokenID; theTextObject: TextObject): OSStatus; C;
FUNCTION SetNumFmtTokenToText(customNumberFormatterObject: LocaleNumberFormatterObjectRef; tokenID: NumberFormatterTokenID; theTextObject: ConstTextObject): OSStatus; C;
FUNCTION GetLocaleLongCurrencyPosition(customNumberFormatterObject: LocaleNumberFormatterObjectRef; VAR position: CurrencyPosition): OSStatus; C;
FUNCTION SetLocaleLongCurrencyPosition(customNumberFormatterObject: LocaleNumberFormatterObjectRef; position: CurrencyPosition): OSStatus; C;
FUNCTION GetLocaleAbbrevCurrencyPosition(customNumberFormatterObject: LocaleNumberFormatterObjectRef; VAR position: CurrencyPosition): OSStatus; C;
FUNCTION SetLocaleAbbrevCurrencyPosition(customNumberFormatterObject: LocaleNumberFormatterObjectRef; position: CurrencyPosition): OSStatus; C;
FUNCTION GetLocaleFirstRangeCurrency(customNumberFormatterObject: LocaleNumberFormatterObjectRef; VAR maxValueInRange: UInt32): OSStatus; C;
FUNCTION SetLocaleFirstRangeCurrency(customNumberFormatterObject: LocaleNumberFormatterObjectRef; maxValueInRange: UInt32): OSStatus; C;
FUNCTION GetLocaleSecondRangeCurrency(customNumberFormatterObject: LocaleNumberFormatterObjectRef; VAR maxValueInRange: UInt32): OSStatus; C;
FUNCTION SetLocaleSecondRangeCurrency(customNumberFormatterObject: LocaleNumberFormatterObjectRef; maxValueInRange: UInt32): OSStatus; C;
FUNCTION GetLocaleDigitText(customNumberFormatterObject: LocaleNumberFormatterObjectRef; theDigit: ByteParameter; theTextObject: TextObject): OSStatus; C;
FUNCTION SetLocaleDigitText(customNumberFormatterObject: LocaleNumberFormatterObjectRef; theDigit: ByteParameter; theTextObject: TextObject): OSStatus; C;